from itertools import chain
import pandas as pd
import numpy as np
import torch
"""实际上并不好用，只是把几组数据拼在一起组成一个新的迭代器"""


df = pd.read_csv("./out.csv", index_col=0)
# print(df)

a =list(df['param0'])
# print(type(a))
b = list(chain(a))  # chain()内部必须是可迭代的对象，不能是单个值
print(*b)

x1 = np.array([1, 2, 3])
x2 = np.array([4, 5, 6])
print(chain(x1,x2))  # 返回一个对象地址
print(*chain(x1,x2))

x1 = [1, 2, 3]
x2 = [4, 5, 6]
print(*chain(x1, x2))
# for i in chain(x1,x2):
#     print(i)

y1 = torch.tensor([1,2,3])
y2 = torch.tensor([4,5,6])
print(*chain(y1,y2))

y1 = torch.tensor([[1,2,3],[2,3,4],[4,5,6]])
y2 = torch.tensor([4,5,6])
print(*chain(y1,y2))